<?php

namespace App\Modules\CodeDesigner\Strategy\Mode;

use App\Modules\CodeDesigner\Strategy\BaseStrategy;

class StrategyC extends BaseStrategy
{
    /**
     * 满足条件
     * @var
     */
    protected $moneyCondition;

    /**
     * 返还
     * @var
     */
    protected $moneyReturn;

    public function __construct(int $moneyCondition, int $moneyReturn)
    {
        $this->moneyCondition = $moneyCondition;
        $this->moneyReturn = $moneyReturn;
    }

    public function getResult(float $money): float
    {
        if ($money > $this->moneyCondition) {
            return $money - $this->moneyReturn;
        }
        return $money;
    }
}